package com.Utils3D;

import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.Vector;

import android.content.res.AssetManager;


public class GenericModelLoader {

	protected final static int FLOAT_SIZE_BYTES = 4;
	protected final static int SHORT_SIZE_BYTES = 2;
	protected final static int INTEGER_SIZE_BYTES = 4;
	
	private enum modelFormat {
	    _OBJ, _3DS, 
	    _NOT_ALLOWED }
	
	public static Model3D loadModel(String filename)
	{
		Model3D m;
		switch (getModelFormat(filename)) 
		{
			case _OBJ:
				m = LoaderOBJ.loadObjModel(filename);
				break;
			case _3DS:
				m = Loader3ds.load3dsModel(filename);
				break;
			default:
				m = null;
				break;
		}
		return m;
	}
	
	public static Model3D loadModel(String filename, AssetManager asset)
	{
		Model3D m;
		switch (getModelFormat(filename)) 
		{
			case _OBJ:
				m = LoaderOBJ.loadObjModel(filename, asset);
				break;
			case _3DS:
				m = Loader3ds.load3dsModel(filename, asset);
				break;
			default:
				m = null;
				break;
		}
		return m;
	}
	
	private static modelFormat getModelFormat(String filename)
	{
		if (filename.endsWith(".obj")) return modelFormat._OBJ;
		else if (filename.endsWith(".3ds")) return modelFormat._3DS;
		else return modelFormat._NOT_ALLOWED;
	}
}
